<template>
    <div>
        <a-modal
            title="修改发起时间"
            :visible="visible"
            @ok="handleOk"
            @cancel="handleClocse"
            cancelText="关闭"
            width="50%"
            wrapClassName=""
            :dialog-style="{ margin: '0 auto'}"
            >
            <a-form :form="form" ref="form" :label-col="{ span: 5 }" :wrapper-col="{ span: 12 }">
                <a-form-item ref="flglx" prop="flglx" label="当前申请发起时间" style="text-align: center;">
                    <a-date-picker
                        show-time
                        format="YYYY-MM-DD HH:mm"
                        v-model="form.sqsj"
                        :allowClear="false"
                        placeholder="请选择发起时间"
                        @change="timeChange"
                    />
                </a-form-item>
            </a-form>
        </a-modal>
    </div>
</template>
<script>
import { updatesqsj } from './service/index'
import moment from 'moment'
export default {
    props: {
    },
    data() {
        return {
            moment:moment,
            visible: false,
            form: this.$form.createForm(this, { name: 'coordinated' }),
            form: {}
        }
    },
    mounted() {
    },
    methods: {
        getData(val){
            if(val){
                this.form = val

                //console.log(this.form)
            }
        },
        timeChange(val){
            this.form.sqsj = val
        },
        handleOk(){
            //console.log(this.form.sqsj)
            var that = this
            that.$confirm({
                title: '您确定要修改发起时间吗?',
                onOk() {
                    let data = {
                        pid: that.form.pid,
                        sqsj: moment(that.form.sqsj).format('YYYY-MM-DD HH:mm')
                    }
                    //console.log(data)
                    updatesqsj(data).then(res => {
                        if(res.success){
                            that.$message.success('修改成功！')
                            that.$emit('updataFuntion')
                        } else {
                            that.$message.warning(res.message)
                        }
                    })
                },
                onCancel() {
                    //console.log('Cancel');
                },
            });
        },
        handleClocse(){
            this.visible = false
        }
    },
}
</script>
